package com.jhhc.WaterQuality.Calculate.Forecast.service.impl;

import com.jhhc.WaterQuality.Calculate.Forecast.entity.WQ_AWQMD_D;
import com.jhhc.RHDB.Data.Dao.WQ_AWQMD_DMapper;
import com.jhhc.WaterQuality.Calculate.Forecast.service.WQ_AWQMD_DService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * (WqAwqmdD)表服务实现类
 *
 * @author makejava
 * @since 2023-08-19 15:18:15
 */
@Service("wqAwqmdDService")
public class WQ_AWQMD_DServiceImpl implements WQ_AWQMD_DService {
    @Resource
    private WQ_AWQMD_DMapper WQAWQMDDMapper;
    @Value("${datasourceType}")
    String datasourceType;
    @Override
    public int insertOrUpdateBatch(List<WQ_AWQMD_D> entities) {
        if ("mysql".equals(datasourceType)){
            return WQAWQMDDMapper.insertBatch(entities);
        }else if ("sqlserver".equals(datasourceType)){
            return WQAWQMDDMapper.insertOrUpdateDataList(entities);
        }
        return 0;
    }

    @Override
    public int deleteAll() {
        return WQAWQMDDMapper.deleteAll();
    }

    @Override
    public List<WQ_AWQMD_D> queryAllByStcds(List<String> stationCodes, String startTime, String endTime) {
        return WQAWQMDDMapper.queryAllByStcds(stationCodes, startTime, endTime);
    }

    @Override
    public WQ_AWQMD_D selectAWQMDNewEstData(String stcd) {
        return WQAWQMDDMapper.selectAWQMDNewEstData(stcd);
    }


}
